<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
    <script>
        $(document).ready(function() {
            $.ajax({
                url : "/User/index",//请求地址
                dataType : 'json',//数据格式
                type : "post",//请求方式
                data :"",
                async : false,//是否异步请求
                success : function(msg) {//如何发送成功
                    var data = eval(msg);//将msg化为数
                    var num = 1;
                    $.each(data, function (num){
                        //alert(data[num].userName);
                        var id = data[num].userId;//注意要与实体类中的名称相同
                        var Name = data[num].userName;
                        var Phone = data[num].userPhone;
                        var Address = data[num].userAdress;

                        var value = "<tr><td align='center'><input name='checked' type='checkbox'  value="+id+"/></td>";
                        value +="<td align='center'>"+Name+"</td> <td align='center'>"+Name+"</td> <td align='center'>"+Phone+"</td> <td align='center'>"+Address+"</td><tr/>";
                        $("#tb").append(value);//写入到id为tb的html部分
                    });
                },
            })
        })
    </script>
</head>
<body>
<table  id="tb" width="80%" border="1" cellspacing="0" cellpadding="0"  align="center" >
    <tr>
        <%--   <th align="center"><input name="checked" type="checkbox" /></th>--%>
        <th align="center">ID</th>
        <th align="center">Name</th>
        <th align="center">Password</th>
        <th align="center">Phone</th>
        <th align="center">Address</th>
    </tr>
</table>
</body>
</html>